/**
 * @properties={typeid:35,uuid:"834DEAEC-7E0D-4D94-A0B1-A8A0D86FDDCA",variableType:-4}
 */
var $vendedor = null;
/**
 * @properties={typeid:35,uuid:"92FE7D9A-54C9-4F29-B654-92E21B4349D3",variableType:-4}
 */
var $cif = null;
/**
 * @properties={typeid:35,uuid:"236C37EA-7C60-406F-B9D6-FA8EF20D8CEA",variableType:-4}
 */
var $nombre = null;
/**
 * @properties={typeid:35,uuid:"EAA0CE2E-C2E8-4751-8C43-E8C7537EB1C1",variableType:-4}
 */
var $direccion = null;
/**
 * @properties={typeid:35,uuid:"8F45F261-32EA-4D14-B567-C769971496E6",variableType:-4}
 */
var $poblacion = null;
/**
 * @properties={typeid:35,uuid:"2FB80D03-4FD7-4C18-9D04-9355F43FB962",variableType:-4}
 */
var $provincia = null;
/**
 * @properties={typeid:35,uuid:"5B23559E-32B8-49AE-B016-B5094EE894E9",variableType:-4}
 */
var $telefono = null;
/**
 * @properties={typeid:35,uuid:"0838934D-44CB-4052-9EE4-B1516A808493",variableType:-4}
 */
var $movil = null;

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"015DF7E3-9D45-4C67-8A70-9497985A06FC"}
 */
function onShow(firstShow, event) {

	inicializar_variables();
}

/**
 * @properties={typeid:24,uuid:"78E7023E-873B-4FCA-BF6B-70B35B678839"}
 */
function inicializar_variables(){
	
	$cif = null;
	$direccion = null;
	$movil = null;
	$poblacion = null;
	$provincia = null;
	$telefono = null;
	$vendedor = null;
	$nombre = null;
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"3CE479EC-75A1-437B-A8CE-631B7B7E5F84"}
 */
function btn_nuevo_cliente(event) {

	var win = application.createWindow(application.getUUID().toString(),JSWindow.MODAL_DIALOG);
	win.resizable = false;
	win.storeBounds = false;
	win.undecorated = true;
	forms.frm_clientes_dlg.controller.newRecord();
	forms.frm_clientes_dlg.doEdit(event);
	win.show(forms.frm_clientes_dlg);
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"FCC7DC9E-95D4-4C0B-A163-169AAAA00C88"}
 * @AllowToRunInFind
 */
function btn_buscar(event) {
	
	forms.lst_clientes.foundset.find();
	if ($nombre) forms.lst_clientes.nombre = "#%" + $nombre + "%";
	if ($cif) forms.lst_clientes.dni_cif = "#%" + $cif + "%";
	if ($direccion) forms.lst_clientes.direccion = "#%" + $direccion + "%";
	if ($movil) forms.lst_clientes.movil = $movil;
	if ($poblacion) forms.lst_clientes.poblacion = "#%" + $poblacion + "%";
	if ($provincia) forms.lst_clientes.provincia = "#%" + $provincia + "%";
	if ($telefono) forms.lst_clientes.telefono = "#%" + $telefono + "%";
	if ($vendedor) forms.lst_clientes.vendedores = $vendedor;
	forms.lst_clientes.foundset.search();
	
}

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"829080D9-C496-40E9-A92B-357F738C8424"}
 */
function btn_cancelar_busqueda(event) {

	inicializar_variables();
	forms.lst_clientes.foundset.loadAllRecords();
}
